package com.aaa.service.impl;

import com.aaa.dao.OrderDao;
import com.aaa.pojo.DefaultMsg;
import com.aaa.pojo.Order;
import com.aaa.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderDao orderDao;

    @Override
    public List<Order> findAllOrder() {
        return orderDao.findAllOrder();
    }

    @Override
    public DefaultMsg updateStatusByOrderId(Integer orderId,Integer status) {
        DefaultMsg defaultMsg = new DefaultMsg(200, 1, null, null);
        int i = orderDao.updateStatusByOrderId(orderId,status);
        if (i == 0) defaultMsg.setMsg(0);
        return defaultMsg;
    }
}
